﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using GoodMan.Infrastructure.Entities.Repository;
namespace GoodMan.Infrastructure.Entities.Entity
{
    public class Information : IAccessible<T_Information, Information>, ILogicEntity<T_Information, Information>
    {
        public int Id { get; set; }
        public string Category { get; set; }
        public string Title { get; set; }
        public string RecruitDep { get; set; }
        public int RecruitNum { get; set; }
        public string SalaryLevel { get; set; }
        public string SexReq { get; set; }
        public string WorkArea { get; set; }
        public string JobDescrption { get; set; }
        public string LinkMan { get; set; }
        public string Phone { get; set; }
        public string EmailAdress { get; set; }
        public DateTime ExpireDate { get; set; }
        public int CTR { get; set; }
        public DateTime PubDate { get; set; }

        protected override void Covariant(T_Information model)
        {
            this.Category = model.Category;
            this.CTR = model.CTR;
            this.EmailAdress = model.EmailAdress;
            this.ExpireDate = model.ExpireDate;
            this.Id = model.Id;
            this.JobDescrption = model.JobDescrption;
            this.LinkMan = model.LinkMan;
            this.Phone = model.Phone;
            this.PubDate = model.PubDate;
            this.RecruitDep = model.RecruitDep;
            this.RecruitNum = model.RecruitNum;
            this.SalaryLevel = model.SalaryLevel;
            this.SexReq = model.SexReq;
            this.Title = model.Title;
            this.WorkArea = model.WorkArea;
        }

        protected override T_Information Inverter(Information model)
        {
            if (model != null)
            {
                return new T_Information()
                {
                    Category = model.Category,
                    CTR = model.CTR,
                    EmailAdress = model.EmailAdress,
                    ExpireDate = model.ExpireDate,
                    Id = model.Id,
                    JobDescrption = model.JobDescrption,
                    LinkMan = model.LinkMan,
                    Phone = model.Phone,
                    PubDate = model.PubDate,
                    RecruitDep = model.RecruitDep,
                    RecruitNum = model.RecruitNum,
                    SalaryLevel = model.SalaryLevel,
                    SexReq = model.SexReq,
                    Title = model.Title,
                    WorkArea = model.WorkArea
                };
            }
            return null;
        }

        public Information Set(T_Information dbModel)
        {
            Covariant(dbModel);
            return this;
        }
    }
}
